package wox.lonice.dto.wechat;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.builder.ToStringBuilder;
import wox.lonice.entity.WeArticleInfo;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * 微信文章信息
 * //        {"app_msg_cnt":18,"app_msg_list":[{
 * "aid":"2247487579_2","appmsgid":2247487579,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2n7ibuJCj47icgla3D14j4jqDWaE4Ceh6XfcrDorT5xNCDOjbfN23FfuvARto7aWbf1ePJAqrrco47w/0?wx_fmt=jpeg",
 * "digest":"来呀，搞事情。","item_show_type":0,"itemidx":2,
 * "link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247487579&idx=2&sn=0bc0fc349620ff3f7c7c1673f0bb7995&chksm=fd8ec2e5caf94bf3aa3d64bffb012951a68a8b7586b8ecb97645f57c26223e85b8ac46a035fe#rd",
 * "tagid":[],"title":"<em>SS</em>计划 投稿作者群 第四波","update_time":1528729222},{"aid":"2247484746_2","appmsgid":2247484746,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2ljbh5fUCDGLwRVSYKENZrQnc5hrLHlWiaSZC4G7sTRVAq8iaWfVyEOywuYJ8dBzE8lfiaRfA9K9xJ3A/0?wx_fmt=jpeg","digest":"每日一句话。","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247484746&idx=2&sn=e0770f7368bae9c4afe5c477615d2d56&chksm=fd8ed7f4caf95ee291a271a4e3358811bc95c60f2ab2239f89be65a46e91aa6d725373abdfb7#rd","tagid":[],"title":"<em>SS</em>每日签","update_time":1512815809},{"aid":"2247488266_2","appmsgid":2247488266,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2nibt2Z2f0NYbwTzJ0NwibAW2wwx8zKjk2pp6pdsDZopb51Qf73ibvszMTEz8fa7shDKS5TyhibicAs0fQ/0?wx_fmt=jpeg","digest":"我知道你会喜欢的。","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247488266&idx=2&sn=528d0d99260b403c8ce48047fd5b980a&chksm=fd8ec1b4caf948a26a47c1d0976f02cf647e74e66f27809341becf24d52fd4a617ac1175df88#rd","tagid":[],"title":"“<em>SS</em>计划为你准备了特别的礼物。”","update_time":1532359285},{"aid":"2247484500_2","appmsgid":2247484500,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2kpaia6MdOgoB2TLc9ibCzM6JBw2ddLKdg4O52OhyXVrM0YMiaaOicKW7Wic1ibMZT4szb6HTMQlCOvSKGA/0?wx_fmt=jpeg","digest":"","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247484500&idx=2&sn=d23e023c20fdde39a5caef6a39d78dc9&chksm=fd8ed6eacaf95ffcf8e2bce672f654e3410cb3466bfbc38e5bf01573f69bffaf163741337ad8#rd","tagid":[],"title":"<em>SS</em>每日签","update_time":1511084551},{"aid":"2247484561_2","appmsgid":2247484561,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2nYd23gdqe4FMBBvXbrYvvTIGKalvQRR3WDbgx1o5u4vianIoj3ibD1ib58j7Im0eFaRddg3Fu0ciazPQ/0?wx_fmt=jpeg","digest":"冗长的黑暗中，你是我唯一的光。  ——东野圭吾《白夜行》投稿 铁皮","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247484561&idx=2&sn=38304883f150968f7dbf17e7c9f076a5&chksm=fd8ed62fcaf95f3937c3ee62f033b5f924c0ad471833b75b76e26150ef8e61748925fc389d33#rd","tagid":[],"title":"<em>SS</em>每日签","update_time":1511778277},{"aid":"2247484580_2","appmsgid":2247484580,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2lxuhTtnWbT06lBeTicXEcdrFrneUK8kr2xTQ74kckbWqHt9owcCDdkjOMFHkmtAw0DjciaXDNPC4tg/0?wx_fmt=jpeg","digest":"一辈子是一辈子。差一年、一个月、一天、一个时辰，都不能算“一辈子”。——《霸王别姬》李碧华","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247484580&idx=2&sn=99fdfb2d37d8d0f342a3cb1d1aea7ff6&chksm=fd8ed61acaf95f0c864cd1ab59e792e869224c34f89561e633aef726468705623600cb3bf910#rd","tagid":[],"title":"<em>SS</em>每日签","update_time":1511959388},{"aid":"2247484464_2","appmsgid":2247484464,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2l1elhtbtCico5YNkAeHWKY9HdRIkdEricqOKOkRvjfBD0twxee1UCdaR5wLJ0qw33dzeea7ufYvSjg/0?wx_fmt=jpeg","digest":"","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247484464&idx=2&sn=d6c0b255870b93b3e3a0ef361491c7f8&chksm=fd8ed68ecaf95f984d355fdd6dc4009a008cc6e58af97a67de8760f98cdb7ad57f4120b74b2e#rd","tagid":[],"title":"<em>SS</em>每日签","update_time":1510741032},{"aid":"2247487156_2","appmsgid":2247487156,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2n4r4fxMpCgHEFq7zN61jjjdFj1sibTyX2Wib6PYDT3GocTtUibGgVvPFRhrLFnHibZ7ITSkLL7ZUb99g/0?wx_fmt=jpeg","digest":"欢迎来“搞“~","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247487156&idx=2&sn=4c748bed438db6bb5a78ca75bfbfad50&chksm=fd8edc0acaf9551c1d913252d02af20bd4e2fb3ec3251caf8833eb7d0bd3dd2e28d343357f7f#rd","tagid":[],"title":"<em>SS</em>计划-新增微信群","update_time":1526656363},{"aid":"2247487408_2","appmsgid":2247487408,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2kVDnibA8dKtP36csBdnzI2WCxqLlT4MeBlkvpZmXQJ4quuiaH81uJBTEc2hYGCFdrbuibYgRzETphFg/0?wx_fmt=jpeg","digest":"一同了解，世间人物。","item_show_type":0,"itemidx":2,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247487408&idx=2&sn=5e4552f34eb550a93532fd89f4b42f8c&chksm=fd8edd0ecaf95418235b324a6c921d94ea665c03a5ca04d4cea2aa02e95a2bf690f14ca5c104#rd","tagid":[],"title":"<em>SS</em>计划 周六人物 约稿函","update_time":1527866503},{"aid":"2247488301_1","appmsgid":2247488301,"cover":"https://mmbiz.qlogo.cn/mmbiz_jpg/R49SO4y2T2mMy3WxWKcBPot0kRSVfjCWf25iaDRHSOpYbfLj64n2ZekiaLUqnmtsr7WpFqHRSXn4gvoJwp4ibXu3Q/0?wx_fmt=jpeg","digest":"接下来的路，也希望有你陪伴。","item_show_type":0,"itemidx":1,"link":"http://mp.weixin.qq.com/s?__biz=MzU4NTEwNzQwOQ==&mid=2247488301&idx=1&sn=79881432dcced9a90d1a085f8fc7b771&chksm=fd8ec193caf94885be5ac2a7cded42ca568576b4fb90dad6b3ff00a88fb1cf8ce713195626b9#rd","tagid":[],"title":"“我们一起走过|<em>SS</em>计划一周年”","update_time":1532616069}],"base_resp":{"err_msg":"ok","ret":0}}
 */
public class WeArticle implements Serializable {

    private String aid;
    private String appmsgid;
    private String cover;//文章小图片
    private String digest;//说明
    private Integer item_show_type;
    private String itemidx;
    private String link;
    private Object tagid;
    private String title;//文章标题
    private Long update_time;//更新时间

    public String getAid() {
        return aid;
    }

    public WeArticle setAid(String aid) {
        this.aid = aid;
        return this;
    }

    public String getAppmsgid() {
        return appmsgid;
    }

    public WeArticle setAppmsgid(String appmsgid) {
        this.appmsgid = appmsgid;
        return this;
    }

    public String getCover() {
        return cover;
    }

    public WeArticle setCover(String cover) {
        this.cover = cover;
        return this;
    }

    public String getDigest() {
        return digest;
    }

    public WeArticle setDigest(String digest) {
        this.digest = digest;
        return this;
    }

    public Integer getItem_show_type() {
        return item_show_type;
    }

    public WeArticle setItem_show_type(Integer item_show_type) {
        this.item_show_type = item_show_type;
        return this;
    }

    public String getItemidx() {
        return itemidx;
    }

    public WeArticle setItemidx(String itemidx) {
        this.itemidx = itemidx;
        return this;
    }

    public String getLink() {
        return link;
    }

    public WeArticle setLink(String link) {
        this.link = link;
        return this;
    }

    public Object getTagid() {
        return tagid;
    }

    public WeArticle setTagid(Object tagid) {
        this.tagid = tagid;
        return this;
    }

    public String getTitle() {
        return title;
    }

    public WeArticle setTitle(String title) {
        this.title = title;
        return this;
    }

    public Long getUpdate_time() {
        return update_time;
    }

    public WeArticle setUpdate_time(Long update_time) {
        this.update_time = update_time;
        return this;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public WeArticleInfo returnEntity() {
        return new WeArticleInfo().setAid(this.aid)
                .setAppmsgid(this.appmsgid)
                .setCover(this.cover)
                .setDigest(this.digest)
                .setItemShowType(this.item_show_type)
                .setLink(this.link)
                .setTagid(JSONObject.toJSONString(this.tagid))
                .setTitle(this.title)
                .setUpdateTime(LocalDateTime.ofEpochSecond(this.update_time,0, ZoneOffset.ofHours(8)));
    }
}
